import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Calculations;
import org.rsbot.script.methods.Camera;
import org.rsbot.script.methods.ClanChat;
import org.rsbot.script.methods.Combat;
import org.rsbot.script.methods.Environment;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.GroundItems;
import org.rsbot.script.methods.Interfaces;
import org.rsbot.script.methods.Inventory;
import org.rsbot.script.methods.Keyboard;
import org.rsbot.script.methods.Mouse;
import org.rsbot.script.methods.NPCs;
import org.rsbot.script.methods.Objects;
import org.rsbot.script.methods.Players;
import org.rsbot.script.methods.Settings;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.methods.Walking;
import org.rsbot.script.util.Timer;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSCharacter;
import org.rsbot.script.wrappers.RSComponent;
import org.rsbot.script.wrappers.RSGroundItem;
import org.rsbot.script.wrappers.RSInterface;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSModel;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSPath;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;

@ScriptManifest(authors={"Debauchery"}, name="DebaucherySoulWars", version=0.33D, description="")
public class DebaucherySoulWars extends Script
  implements MouseListener, MessageListener, PaintListener
{
  private final int randomTeamID = 42031;
  private final int blueBarrierID = 42029;
  private final int bandageID = 14640;
  private final int pyresID = 8598;
  private final int jelliesID = 8599;
  private final int redBarrierID = 42030;
  private final int bonesID = 14638;
  private int zeal;
  private int won;
  private int lost;
  private int drew;
  private int blueShouts;
  private int redShouts;
  private int kicked;
  private int maxiumTimeForBreak;
  private int maxiumTimeUntillBreak;
  private int minimiumTimeForBreak;
  private int minimiumTimeUntillBreak;
  private final int[] BarrierID;
  private final int[] bandageTableID;
  private final int[] barricadeID;
  private final int[] blueAvatarID;
  private final int[] redAvatarID;
  private final int[] fragmentID;
  private final int[] arrowsID;
  private String result;
  private String task;
  private String breakHandlerStatus;
  private boolean randomTeam;
  private boolean lastWonTeam;
  private boolean lastLostTeam;
  private boolean redTeam;
  private boolean blueTeam;
  private boolean clanChatTeam;
  private boolean takeBreak;
  private boolean attackAvatar;
  private boolean attackPyres;
  private boolean attackJellies;
  private boolean getSupplies;
  private boolean healOthers;
  private boolean pickUpBones;
  private boolean attackPlayers;
  private boolean randomStrat;
  private boolean pureMode;
  private boolean blueLast;
  private boolean redLast;
  private boolean inClan;
  private boolean buryAtGrave;
  private boolean pickUpArrows;
  private boolean weaponSpec;
  private boolean quickPrayer;
  private boolean takingBreak;
  private boolean startedBreak;
  private boolean stoppedBreak;
  private boolean startScript;
  private boolean hide;
  private DebaucherySoulWars.SWGUI gui;
  private DebaucherySoulWars.Pitch pitch;
  private DebaucherySoulWars.Angle angle;
  private DebaucherySoulWars.ExtraAntiban extraAntiban;
  private DebaucherySoulWars.BreakHandler breakHandler;
  private Timer run;
  private RSTile tempTile;
  private DebaucherySoulWars.Strategies current;
  RSPath path;
  public Rectangle hideRect;
  private final Image img1;
  private final Image hideImg;

  public DebaucherySoulWars()
  {
    this.randomTeamID = 42031; this.blueBarrierID = 42029; this.bandageID = 14640; this.pyresID = 8598; this.jelliesID = 8599; this.redBarrierID = 42030; this.bonesID = 14638;

    this.BarrierID = new int[] { 42013, 42014, 42015, 42016, 42017, 42018 }; this.bandageTableID = new int[] { 42023, 42024 }; this.barricadeID = new int[] { 8600 }; this.blueAvatarID = new int[] { 8597 }; this.redAvatarID = new int[] { 8596 }; this.fragmentID = new int[] { 14646, 15792 }; this.arrowsID = new int[] { 9242, 13280, 9142, 864, 863 };

    this.hideRect = new Rectangle(504, 209, 14, 14);

    this.img1 = getImage("http://img43.imageshack.us/img43/5479/logoym.png");
    this.hideImg = getImage("http://www.authorstream.com/images/close_icon.gif");
  }

  public boolean onStart()
  {
    this.gui = new DebaucherySoulWars.SWGUI(this);
    this.gui.setVisible(true);
    while (!this.startScript) {
      sleep(10);
    }
    this.gui.setVisible(false);
    this.run = new Timer(0L);
    this.mouse.setSpeed(random(8, 10));
    this.angle = new DebaucherySoulWars.Angle(this);
    this.pitch = new DebaucherySoulWars.Pitch(this);
    this.pitch.start();
    this.angle.start();
    if (this.takeBreak) {
      this.breakHandler = new DebaucherySoulWars.BreakHandler(this);
      this.breakHandler.start();
    }
    if (this.clanChatTeam) {
      this.inClan = this.clanChat.isInChannel();
      if (!this.inClan) {
        this.clanChat.join(this.clanChat.getLastChannel());
        this.inClan = this.clanChat.isInChannel();
      }
    }
    this.combat.setAutoRetaliate(!this.pureMode);
    this.extraAntiban = new DebaucherySoulWars.ExtraAntiban(this);
    this.extraAntiban.start();
    return true;
  }

  public int loop()
  {
    this.path = null;
    this.tempTile = null;
    if (((getLocation().equals(DebaucherySoulWars.Location.OUTSIDE)) || (this.game.getClientState() == 7) || (!this.game.isLoggedIn())) && (this.takingBreak))
    {
      this.task = "Waiting in lobby.";
      if (!this.interfaces.get(1).isValid()) {
        sleep(1000, 12000);
        this.game.logout(true);
      }
      this.startedBreak = true;
      this.stoppedBreak = false;
      this.env.disbleRandoms();
      this.inClan = false;
    } else {
      this.env.enableRandoms();
      this.startedBreak = false;
      this.stoppedBreak = true;
      if ((this.game.isLoggedIn()) && (this.game.getClientState() != 7))
      {
        if ((this.clanChatTeam) && 
          (!this.inClan)) {
          if (this.clanChat.isInChannel()) {
            this.clanChat.join(this.clanChat.getLastChannel());
          }
          this.inClan = this.clanChat.isInChannel();
        }

        if (this.interfaces.get(740).isValid()) {
          if (this.interfaces.canContinue()) {
            this.interfaces.clickContinue();
          }
          sleep(100, 600);
        }
        if (getMyPlayer().getTeam() == 1) {
          this.redLast = false;
          this.blueLast = true;
        } else if (getMyPlayer().getTeam() == 2) {
          this.redLast = true;
          this.blueLast = false;
        }
        if (getLocation().equals(DebaucherySoulWars.Location.OUTSIDE)) {
          if ((this.interfaces.getComponent(243, 4).isValid()) && (this.interfaces.getComponent(243, 4).containsText("You were removed from the game due")))
          {
            this.result = "drewLast";
            this.kicked += 1;
            this.interfaces.clickContinue();
          }
          this.current = null;
          this.task = "Joining Team.";
          joinTeam();
          if (waitTime() > 0)
            sleep(waitTime() * 50000);
        }
        else if ((getLocation().equals(DebaucherySoulWars.Location.RED_WAITING)) || (getLocation().equals(DebaucherySoulWars.Location.BLUE_WAITING)))
        {
          this.current = null;
          this.task = "Waiting for next game.";
          waitingAntiban();
        } else if ((getLocation().equals(DebaucherySoulWars.Location.RED_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.BLUE_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.EAST_GRAVE)) || (getLocation().equals(DebaucherySoulWars.Location.WEST_GRAVE)))
        {
          this.current = null;
          this.task = "Leaving grave or spawn.";
          leave();
          sleep(1000, 2000);
          if (!listenTime()) {
            this.blueShouts = 0;
            this.redShouts = 0;
          }
        } else {
          if ((this.game.getClientState() == 7) || (!this.game.isLoggedIn()))
          {
            return 1;
          }
          if (barricade()) {
            return 1;
          }
          if (this.current == null)
            this.current = getStrategies();
          else {
            switch (DebaucherySoulWars.1.$SwitchMap$DebaucherySoulWars$Strategies[this.current.ordinal()]) {
            case 1:
              this.task = "Picking up bones.";
              bonesStrat();
              break;
            case 2:
              this.task = "Healing others.";
              healPlayersStrat();
              break;
            case 3:
              if (getActivityBarPercent() < 25) {
                if (!this.pickUpBones) break;
                this.task = "Picking Bones(Low activity).";
                bonesStrat();
              }
              else
              {
                this.task = "Attack avatar.";
                avatarStrat();
              }
              break;
            case 4:
              if (getActivityBarPercent() < 25) {
                if (!this.pickUpBones) break;
                this.task = "Picking Bones(Low activity).";
                bonesStrat();
              }
              else
              {
                this.task = "Attacking Pyres.";
                pyresStrat();
              }
              break;
            case 5:
              if (getActivityBarPercent() < 25) {
                if (!this.pickUpBones) break;
                this.task = "Picking Bones(Low activity).";
                bonesStrat();
              }
              else
              {
                this.task = "Attacking Jellies.";
                jelliesStrat();
              }
              break;
            case 6:
              if (getActivityBarPercent() < 25) {
                if (!this.pickUpBones) break;
                this.task = "Picking Bones(Low activity).";
                bonesStrat();
              }
              else
              {
                this.task = "Attacking Players.";
                playersStrat();
              }
            }
          }
        }
      }
    }

    return 1;
  }

  public int findClan()
  {
    sleep(10000, 15000);
    int i = 0;
    int j = 0;
    try
    {
      String[] arrayOfString = this.clanChat.getChannelUsers();
      for (int k = 0; k < arrayOfString.length; k++) {
        RSPlayer localRSPlayer = this.players.getNearest(arrayOfString[k]);
        if (localRSPlayer != null) {
          RSTile localRSTile = localRSPlayer.getLocation();
          if (localRSTile != null) {
            if (DebaucherySoulWars.Location.BLUE_WAITING.containsTile(localRSTile))
              i++;
            else if (DebaucherySoulWars.Location.RED_WAITING.containsTile(localRSTile)) {
              j++;
            }
          }
        }
      }
      if (i > j)
        return 1;
      if (j > i)
        return 2;
    }
    catch (Exception localException) {
    }
    return 0;
  }

  public int waitTime() {
    try {
      if ((this.interfaces.getComponent(211, 1).isValid()) && (this.interfaces.getComponent(211, 1).containsText("You left a game of Soul Wars early")))
      {
        String str1 = this.interfaces.getComponent(211, 1).getText();
        String str2 = str1.substring(str1.indexOf("wait ") + 5, str1.indexOf(" minutes"));

        return Integer.parseInt(str2);
      }
    } catch (Exception localException) {
    }
    return 0;
  }

  private RSTile divideTile(RSTile paramRSTile) {
    RSTile localRSTile = getMyPlayer().getLocation();
    return new RSTile((localRSTile.getX() + 4 * paramRSTile.getX()) / 5, (localRSTile.getY() + 4 * paramRSTile.getY()) / 5);
  }

  private int getOwnAvatarHealth()
  {
    String str = null;
    try
    {
      RSComponent localRSComponent;
      if (getMyPlayer().getTeam() == 1) {
        localRSComponent = this.interfaces.getComponent(836, 11);
        if (localRSComponent != null)
          str = localRSComponent.getText();
      }
      else {
        localRSComponent = this.interfaces.getComponent(836, 15);
        if (localRSComponent != null) {
          str = localRSComponent.getText();
        }
      }
      if (str.equals("---")) {
        return 100;
      }
      str.replace("%", "");
      try {
        return Integer.parseInt(str.trim());
      } catch (Exception localException1) {
      }
    } catch (Exception localException2) {
      return 100;
    }
    return 100;
  }

  private int getOpponentAvatarLevel() {
    String str = null;
    try {
      if (getMyPlayer().getTeam() == 1) {
        str = this.interfaces.get(836).getComponent(14).getText();
        if (!str.equals("---"))
          return Integer.parseInt(str);
      }
      else {
        str = this.interfaces.get(836).getComponent(10).getText();
        if (!str.equals("---"))
          return Integer.parseInt(str);
      }
    }
    catch (Exception localException) {
      return 100;
    }
    return 100;
  }

  private int getActivityBarPercent() {
    RSComponent localRSComponent = this.interfaces.get(836).getComponent(56);
    if ((localRSComponent != null) && (localRSComponent.isValid()) && (localRSComponent.getRelativeY() > -1)) {
      return localRSComponent.getHeight() * 100 / 140;
    }
    return 0;
  }

  private boolean controlsWesternGraveyard() {
    Color localColor = getColor(272, 25);
    if (localColor != null) {
      if (getMyPlayer().getTeam() == 1) {
        return localColor.getBlue() > localColor.getRed();
      }
      return localColor.getRed() > localColor.getBlue();
    }

    return false;
  }

  private boolean controlsEasternGraveyard() {
    Color localColor = getColor(352, 25);
    if (localColor != null) {
      if (getMyPlayer().getTeam() == 1) {
        return localColor.getBlue() > localColor.getRed();
      }
      return localColor.getRed() > localColor.getBlue();
    }

    return false;
  }

  private int chooseTeam() {
    if (this.clanChatTeam) {
      if (this.blueShouts != this.redShouts) {
        if (this.blueShouts > this.redShouts) {
          return 1;
        }
        return 2;
      }

      return findClan();
    }
    if ((this.lastWonTeam) || (this.lastLostTeam)) {
      if (this.result != null) {
        if (this.result.equals("drawLast"))
          return 0;
        if (this.result.equals("wonLast")) {
          if (this.blueLast) {
            if (this.lastWonTeam)
              return 1;
            if (this.lastLostTeam)
              return 2;
          }
          else {
            if (this.lastWonTeam)
              return 2;
            if (this.lastLostTeam)
              return 1;
          }
        }
        else if (this.result.equals("lostLast"))
          if (this.redLast) {
            if (this.lastWonTeam)
              return 1;
            if (this.lastLostTeam)
              return 2;
          }
          else {
            if (this.lastWonTeam)
              return 2;
            if (this.lastLostTeam)
              return 1;
          }
      }
    }
    else {
      if (this.redTeam)
        return 2;
      if (this.blueTeam)
        return 1;
      if (this.randomTeam)
        return 0;
    }
    return 0;
  }

  private void joinTeam() {
    String str = this.interfaces.get(199).getComponent(0).getText();
    if ((this.interfaces.get(211).getComponent(3).isValid()) && (this.interfaces.get(211).getComponent(3) != null))
    {
      this.interfaces.get(211).getComponent(3).doClick();
      sleep(1200, 2000);
    } else if ((this.interfaces.get(228).getComponent(2).isValid()) && (this.interfaces.get(228).getComponent(2) != null))
    {
      this.interfaces.get(228).getComponent(2).doClick();
      sleep(1200, 2000);
    }
    else
    {
      Object localObject1;
      Object localObject2;
      Object localObject3;
      Object localObject4;
      switch (chooseTeam())
      {
      case 0:
        RSObject localRSObject = this.objects.getNearest(new int[] { 42031 });
        if (localRSObject == null) break;
        localObject1 = localRSObject.getLocation();
        if (localObject1 != null) {
          if (localRSObject.isOnScreen()) {
            switch (random(0, 2)) {
            case 0:
              if ((!getLocation().equals(DebaucherySoulWars.Location.OUTSIDE)) || 
                (!localRSObject.doAction("Join-team"))) break;
              sleep(1000, 1300); break;
            case 1:
              localObject2 = localRSObject.getModel();
              if (localObject2 == null) break;
              localObject3 = ((RSModel)localObject2).getPoint();
              if (localObject3 == null) break;
              this.mouse.hop((Point)localObject3);
              if (!getLocation().equals(DebaucherySoulWars.Location.OUTSIDE))
                break;
              this.mouse.click(true);
              sleep(1000, 1300);
            }

          }
          else if ((!localRSObject.isOnScreen()) && (this.calc.distanceTo((RSTile)localObject1) <= 4))
          {
            this.camera.getObjectAngle(localRSObject);
          } else {
            localObject2 = this.walking.getClosestTileOnMap((RSTile)localObject1);

            if (localObject2 != null) {
              this.walking.walkTileMM((RSTile)localObject2);
              sleep(400, 800);
            }
          }
        }
        break;
      case 1:
        localObject1 = this.objects.getNearest(new int[] { 42029 });
        if (localObject1 == null) break;
        localObject2 = ((RSObject)localObject1).getLocation();
        if (localObject2 != null) {
          if (((RSObject)localObject1).isOnScreen()) {
            switch (random(0, 2)) {
            case 0:
              localObject3 = ((RSObject)localObject1).getModel();
              if (localObject3 == null) break;
              localObject4 = ((RSModel)localObject3).getPoint();
              if (localObject4 != null) {
                this.mouse.hop((Point)localObject4);
                if (getLocation().equals(DebaucherySoulWars.Location.OUTSIDE))
                {
                  this.mouse.click(true);
                  sleep(800, 1000);
                }
              }
              break;
            case 1:
              if (getLocation().equals(DebaucherySoulWars.Location.OUTSIDE)) {
                ((RSObject)localObject1).doAction("Pass");
              }
              sleep(800, 1000);
            }
          }
          else if ((!((RSObject)localObject1).isOnScreen()) && (this.calc.distanceTo((RSTile)localObject2) <= 4))
          {
            this.camera.getObjectAngle((RSObject)localObject1);
            this.camera.setPitch(true);
          } else {
            localObject3 = this.walking.getClosestTileOnMap((RSTile)localObject2);

            if (localObject3 != null) {
              this.walking.walkTileMM((RSTile)localObject3);
              sleep(400, 800);
            }
          }
        }
        break;
      case 2:
        localObject2 = this.objects.getNearest(new int[] { 42030 });
        if (localObject2 == null) break;
        localObject3 = ((RSObject)localObject2).getLocation();
        if (localObject3 == null) break;
        if (((RSObject)localObject2).isOnScreen()) {
          switch (random(0, 2)) {
          case 0:
            localObject4 = ((RSObject)localObject2).getModel();
            if (localObject4 == null) break;
            Point localPoint = ((RSModel)localObject4).getPoint();
            if (localPoint != null) {
              this.mouse.hop(localPoint);
              if (getLocation().equals(DebaucherySoulWars.Location.OUTSIDE))
              {
                this.mouse.click(true);
              }
              sleep(800, 1000);
            }
            break;
          case 1:
            if ((!getLocation().equals(DebaucherySoulWars.Location.OUTSIDE)) || 
              (!((RSObject)localObject2).doAction("Pass"))) break;
            sleep(800, 1000);
          }

        }
        else if ((!((RSObject)localObject2).isOnScreen()) && (this.calc.distanceTo((RSTile)localObject3) <= 4))
        {
          this.camera.getObjectAngle((RSObject)localObject2);
          this.camera.setPitch(true);
        } else {
          localObject4 = this.walking.getClosestTileOnMap((RSTile)localObject3);

          if (localObject4 == null) break;
          this.walking.walkTileMM((RSTile)localObject4);
          sleep(400, 800);
        }
      }
    }
  }

  private void waitingAntiban()
  {
    switch (random(0, 7)) {
    case 0:
      sleep(600, 700);
      break;
    case 1:
      this.mouse.moveRandomly(200);
      break;
    case 2:
      this.camera.moveRandomly(random(1000, 1200));
      break;
    case 3:
      this.mouse.moveOffScreen();
      sleep(1200, 2000);
      break;
    case 4:
      sleep(800, 1000);
      break;
    case 5:
      RSTile localRSTile;
      if (getLocation().equals(DebaucherySoulWars.Location.RED_WAITING)) {
        localRSTile = DebaucherySoulWars.Location.RED_WAITING.getRSArea().getCentralTile();

        if ((localRSTile != null) && (this.calc.distanceTo(localRSTile) > 2))
          this.walking.walkTileMM(localRSTile, 2, 2);
      } else {
        if (!getLocation().equals(DebaucherySoulWars.Location.BLUE_WAITING)) break;
        localRSTile = DebaucherySoulWars.Location.BLUE_WAITING.getRSArea().getCentralTile();

        if ((localRSTile != null) && (this.calc.distanceTo(localRSTile) > 2))
          this.walking.walkTileMM(localRSTile, 2, 2);
      }
      break;
    case 6:
      sleep(200);
    }
  }

  private void leave()
  {
    try {
      RSObject localRSObject = this.objects.getNearest(this.BarrierID);
      if ((getLocation().equals(DebaucherySoulWars.Location.RED_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.BLUE_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.EAST_GRAVE)) || (getLocation().equals(DebaucherySoulWars.Location.WEST_GRAVE)))
      {
        if (getMyPlayer().getNPCID() == 8623) {
          if ((random(1, 100) < 25) && 
            (localRSObject != null)) {
            this.walking.walkTileMM(localRSObject.getLocation());
            sleep(600, 1000);
          }

          if ((random(1, 100) < 10) && (
            (getLocation().equals(DebaucherySoulWars.Location.RED_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.BLUE_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.EAST_GRAVE)) || (getLocation().equals(DebaucherySoulWars.Location.WEST_GRAVE))))
          {
            localRSObject.doAction("Pass");
          }

          sleep(100, 600);
        } else if (localRSObject != null) {
          if ((!localRSObject.isOnScreen()) && (this.calc.distanceTo(localRSObject.getLocation()) < 2))
          {
            this.camera.turnTo(localRSObject);
          }
          if (!localRSObject.isOnScreen()) {
            this.walking.walkTileMM(localRSObject.getLocation());
          }
          if ((localRSObject.isOnScreen()) && (getMyPlayer().getAnimation() != 1))
          {
            RSModel localRSModel = localRSObject.getModel();
            this.camera.turnTo(localRSObject);
            sleep(2000, 4000);
            switch (random(0, 5)) {
            case 2:
              if (localRSModel == null) break;
              Point localPoint = localRSModel.getPoint();
              if ((localPoint != null) && (
                (getLocation().equals(DebaucherySoulWars.Location.RED_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.BLUE_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.EAST_GRAVE)) || (getLocation().equals(DebaucherySoulWars.Location.WEST_GRAVE))))
              {
                this.mouse.hop(localPoint);
                this.mouse.click(true);
              }

              break;
            default:
              if ((!getLocation().equals(DebaucherySoulWars.Location.RED_SPAWN)) && (!getLocation().equals(DebaucherySoulWars.Location.BLUE_SPAWN)) && (!getLocation().equals(DebaucherySoulWars.Location.EAST_GRAVE)) && (!getLocation().equals(DebaucherySoulWars.Location.WEST_GRAVE)))
              {
                break;
              }

              localRSObject.doAction("Pass");
            }
          }
        }

      }

      sleep(1000, 2000);
    } catch (Exception localException) {
    }
  }

  private boolean getSupplies() {
    if (this.inventory.containsOneOf(new int[] { 14640 })) {
      return true;
    }
    RSObject localRSObject = this.objects.getNearest(this.bandageTableID);
    int i = random(28, 100);
    if ((localRSObject != null) && (getMyPlayer().getInteracting() == null)) {
      if (!localRSObject.isOnScreen()) {
        this.camera.turnTo(localRSObject);
      }
      if (localRSObject.isOnScreen()) {
        if (localRSObject.doAction("Take-x")) {
          sleep(2500, 3000);
          if ((this.calc.distanceTo(localRSObject) <= 1) && (getMyPlayer().getInteracting() == null))
          {
            if ((this.interfaces.getComponent(752, 5) != null) && (!this.interfaces.getComponent(752, 5).getText().contains(String.valueOf(i))))
            {
              this.keyboard.sendText(String.valueOf(i), false);
              sleep(1000, 1400);
            }
            if ((this.interfaces.getComponent(752, 5) != null) && (this.interfaces.getComponent(752, 5).getText().contains(String.valueOf(i))))
            {
              this.keyboard.sendText("", true);
              sleep(1800, 2000);
            }
          }
        }
      }
      else if (!getMyPlayer().isMoving()) {
        this.walking.walkTileMM(this.walking.getClosestTileOnMap(localRSObject.getLocation()));

        sleep(1000, 2000);
      }
    }

    return false;
  }

  private RSPlayer teamMate() {
    try {
      RSPlayer[] arrayOfRSPlayer1 = this.players.getAll();
      for (RSPlayer localRSPlayer : arrayOfRSPlayer1) {
        if ((localRSPlayer != null) && (localRSPlayer.isOnScreen()) && 
          (getMyPlayer().getTeam() == localRSPlayer.getTeam()) && 
          (localRSPlayer.getHPPercent() < 90)) {
          return localRSPlayer;
        }

      }

      return null; } catch (Exception localException) {
    }
    return null;
  }

  private void healOthers()
  {
    this.camera.setPitch(true);
    try
    {
      Object localObject;
      if ((this.inventory.getSelectedItem() != null) && (this.inventory.getSelectedItem().getID() == 14640))
      {
        localObject = this.inventory.getItem(new int[] { 14640 });
        if (localObject != null)
          ((RSItem)localObject).doClick(true);
      }
      else {
        switch (random(1, 3)) {
        case 1:
          if (teamMate() == null) break;
          localObject = teamMate().getModel();
          if (localObject != null) {
            Point localPoint = ((RSModel)localObject).getPoint();
            if (localPoint != null) {
              this.mouse.hop(localPoint);
              this.mouse.click(true);
              sleep(3000, 5000);
            }
          }
          break;
        case 2:
          opponent().doAction("Heal " + teamMate().getName());
          sleep(3000, 5000);
        }
      }
    }
    catch (Exception localException) {
    }
  }

  private RSPlayer opponent() {
    try {
      RSPlayer[] arrayOfRSPlayer1 = this.players.getAll();
      for (RSPlayer localRSPlayer : arrayOfRSPlayer1) {
        if ((localRSPlayer != null) && (localRSPlayer.isOnScreen()) && 
          (getMyPlayer().getTeam() != localRSPlayer.getTeam()) && 
          (localRSPlayer.getHPPercent() > 30)) {
          return localRSPlayer;
        }

      }

      return null; } catch (Exception localException) {
    }
    return null;
  }

  private void attack()
  {
    this.camera.setPitch(true);
    try {
      RSPlayer localRSPlayer = opponent();
      Object localObject;
      if ((localRSPlayer != null) && (DebaucherySoulWars.Location.OBELISK.containsTile(localRSPlayer.getLocation()))) {
        if (getMyPlayer().getInteracting() == null)
          switch (random(1, 3)) {
          case 1:
            if (localRSPlayer == null) break;
            localObject = localRSPlayer.getModel();
            if (localObject != null) {
              Point localPoint = ((RSModel)localObject).getPoint();
              if (localPoint != null) {
                this.mouse.hop(localPoint);
                this.mouse.click(true);
                sleep(3000, 5000);
              }
            }
            break;
          case 2:
            localRSPlayer.doAction("Attack");
            sleep(3000, 5000);
          }
      }
      else
      {
        if ((this.pickUpBones) && (
          (getActivityBarPercent() < 100) || (this.buryAtGrave))) {
          localObject = this.groundItems.getNearest(new int[] { 14638 });
          ((RSGroundItem)localObject).doAction("Take " + ((RSGroundItem)localObject).getItem().getName());
          return;
        }

        pickUpArrows();
        if ((!getMyPlayer().isMoving()) || (this.calc.distanceTo(this.walking.getDestination()) < 5))
        {
          this.walking.walkTileMM(this.walking.getClosestTileOnMap(getMyPlayer().getTeam() == 1 ? new RSTile(1901, 3231) : new RSTile(1871, 3233)));

          sleep(1000, 3000);
        }
      }
    }
    catch (Exception localException)
    {
    }
  }

  private void attackAvatar()
  {
    RSNPC localRSNPC;
    RSTile localRSTile;
    if (getMyPlayer().getTeam() == 1) {
      localRSNPC = this.npcs.getNearest(this.redAvatarID);
      if (localRSNPC != null) {
        if (localRSNPC.isOnScreen()) {
          if ((getMyPlayer().getInteracting() == null) || (!getMyPlayer().getInteracting().getName().equals(localRSNPC.getName())))
          {
            localRSNPC.doAction("Attack " + localRSNPC.getName());
            sleep(3000, 5000);
          }
        } else if ((localRSNPC.isOnScreen()) && (this.calc.distanceTo(localRSNPC) < 4)) {
          this.camera.getCharacterAngle(localRSNPC);
        } else {
          localRSTile = localRSNPC.getLocation();
          if ((localRSTile != null) && (
            (this.calc.distanceTo(this.walking.getDestination()) < 4) || (!getMyPlayer().isMoving())))
          {
            this.walking.walkTileMM(this.walking.getClosestTileOnMap(localRSTile));
          }
        }
      }
    }
    else
    {
      localRSNPC = this.npcs.getNearest(this.blueAvatarID);
      if (localRSNPC != null)
        if (localRSNPC.isOnScreen()) {
          if ((getMyPlayer().getInteracting() == null) || (!getMyPlayer().getInteracting().getName().equals(localRSNPC.getName())))
          {
            localRSNPC.doAction("Attack");
            sleep(3000, 5000);
          }
        } else if ((localRSNPC.isOnScreen()) && (this.calc.distanceTo(localRSNPC) < 4)) {
          this.camera.getCharacterAngle(localRSNPC);
        } else {
          localRSTile = localRSNPC.getLocation();
          if ((localRSTile != null) && (
            (this.calc.distanceTo(this.walking.getDestination()) < 4) || (!getMyPlayer().isMoving())))
          {
            this.walking.walkTileMM(this.walking.getClosestTileOnMap(localRSTile));
          }
        }
    }
  }

  private void buryBones()
  {
    if (getActivityBarPercent() < random(60, 80))
      if (this.inventory.containsOneOf(new int[] { 14638 })) {
        RSItem localRSItem = this.inventory.getItem(new int[] { 14638 });
        if (localRSItem != null) {
          localRSItem.doAction("Bury");
          sleep(700, 1200);
        }
      }
  }

  public void destroyBones()
  {
    if (this.inventory.containsOneOf(new int[] { 14638 })) {
      RSItem localRSItem = this.inventory.getItem(new int[] { 14638 });
      if (localRSItem != null) {
        localRSItem.doAction("Destroy");
        sleep(700, 1200);
        if (this.interfaces.get(94).isValid()) {
          RSComponent localRSComponent = this.interfaces.get(94).getComponent(3);
          localRSComponent.doAction("Continue");
        }
        sleep(700, 1200);
      }
    }
  }

  private boolean barricade() {
    try {
      RSNPC localRSNPC = this.npcs.getNearest(this.barricadeID);
      if (localRSNPC != null) {
        RSTile localRSTile = localRSNPC.getLocation();
        if ((localRSTile != null) && 
          (this.calc.distanceTo(localRSTile) <= 2)) {
          if (getMyPlayer().getInteracting().equals(localRSNPC)) {
            return true;
          }
          localRSNPC.doAction("Attack " + localRSNPC.getName());
          sleep(3000, 5000);
          return true;
        }

        return true;
      }
      return false;
    } catch (Exception localException) {
    }
    return false;
  }

  private void attackJellies()
  {
    RSNPC localRSNPC = this.npcs.getNearest(new int[] { 8599 });
    if ((localRSNPC != null) && 
      (localRSNPC != null)) {
      this.camera.setPitch(true);
      if ((this.calc.distanceTo(localRSNPC) > 4) && (!localRSNPC.isOnScreen())) {
        this.walking.walkTileMM(this.walking.getClosestTileOnMap(localRSNPC.getLocation()));
      }

      if (!localRSNPC.isOnScreen()) {
        this.camera.turnTo(localRSNPC);
      }
      if ((localRSNPC.isOnScreen()) && ((getMyPlayer().getInteracting() == null) || (!getMyPlayer().getInteracting().getName().equals(localRSNPC.getName()))))
      {
        localRSNPC.doAction("Attack");
        sleep(3000, 5000);
      }
    }
  }

  private void attackPyres()
  {
    RSNPC localRSNPC = this.npcs.getNearest(new int[] { 8598 });
    if ((localRSNPC != null) && 
      (localRSNPC != null)) {
      this.camera.setPitch(true);
      if ((this.calc.distanceTo(localRSNPC) > 4) && (!localRSNPC.isOnScreen())) {
        this.walking.walkTileMM(this.walking.getClosestTileOnMap(localRSNPC.getLocation()));
      }

      if (!localRSNPC.isOnScreen()) {
        this.camera.turnTo(localRSNPC);
      }
      if ((localRSNPC.isOnScreen()) && ((getMyPlayer().getInteracting() == null) || (!getMyPlayer().getInteracting().getName().equals(localRSNPC.getName()))))
      {
        localRSNPC.doAction("Attack");
        sleep(3000, 5000);
      }
    }
  }

  private void heal()
  {
    if (getMyPlayer().getHPPercent() < 60) {
      RSItem localRSItem = this.inventory.getItem(new int[] { 14640 });
      if (localRSItem != null) {
        localRSItem.doAction("Heal");
        sleep(200, 400);
      }
    }
  }

  private void qPrayer() {
    if ((this.quickPrayer) && 
      (getMyPlayer().getHPPercent() < random(65, 90)) && 
      (!this.combat.isQuickPrayerOn()) && (this.combat.getPrayerPoints() > 1))
      this.interfaces.getComponent(749, 2).doClick();
  }

  private void weaponSpec()
  {
    if ((this.weaponSpec) && 
      (getMyPlayer().getInteracting() != null) && 
      (this.settings.getSetting(301) != 1) && (this.settings.getSetting(300) == 1000))
    {
      if (this.game.getCurrentTab() != 0) {
        this.game.openTab(0);
        sleep(random(300, 900));
      }
      this.mouse.click(645 + random(0, 4), 425 + random(0, 4), true);
    }
  }

  public void pickUpArrows()
  {
    if (this.pickUpArrows) {
      RSGroundItem localRSGroundItem = null;
      for (int i = 0; (localRSGroundItem == null) || (i < this.arrowsID.length); i++) {
        localRSGroundItem = this.groundItems.getNearest(new int[] { this.arrowsID[i] });
        if (localRSGroundItem != null) {
          localRSGroundItem.doAction("Take " + localRSGroundItem.getItem().getName());
          return;
        }
      }
    }
  }

  private DebaucherySoulWars.Location nearestPyres() {
    int i = this.calc.distanceTo(DebaucherySoulWars.Location.NORTHWEST_PRYES.getRSArea().getNearestTile(getMyPlayer().getLocation()));

    int j = this.calc.distanceTo(DebaucherySoulWars.Location.SOUTHEAST_PYRES.getRSArea().getNearestTile(getMyPlayer().getLocation()));

    return j > i ? DebaucherySoulWars.Location.NORTHWEST_PRYES : DebaucherySoulWars.Location.SOUTHEAST_PYRES;
  }

  private DebaucherySoulWars.Location nearestJellies()
  {
    int i = this.calc.distanceTo(DebaucherySoulWars.Location.NORTH_JELLIES.getRSArea().getNearestTile(getMyPlayer().getLocation()));

    int j = this.calc.distanceTo(DebaucherySoulWars.Location.SOUTH_JELLIES.getRSArea().getNearestTile(getMyPlayer().getLocation()));

    return j > i ? DebaucherySoulWars.Location.NORTH_JELLIES : DebaucherySoulWars.Location.SOUTH_JELLIES;
  }

  private DebaucherySoulWars.Location nearestSupplies()
  {
    int i = this.calc.distanceTo(DebaucherySoulWars.Location.BLUE_SUPPLIES.getRSArea().getNearestTile(getMyPlayer().getLocation()));

    int j = this.calc.distanceTo(DebaucherySoulWars.Location.RED_SUPPLIES.getRSArea().getNearestTile(getMyPlayer().getLocation()));

    return j > i ? DebaucherySoulWars.Location.BLUE_SUPPLIES : DebaucherySoulWars.Location.RED_SUPPLIES;
  }

  private DebaucherySoulWars.Location nearestOwnedGrave()
  {
    if ((controlsWesternGraveyard()) && (controlsEasternGraveyard())) {
      int i = this.calc.distanceTo(DebaucherySoulWars.Location.EAST_GRAVE_OUT.getRSArea().getNearestTile(getMyPlayer().getLocation()));

      int j = this.calc.distanceTo(DebaucherySoulWars.Location.WEST_GRAVE_OUT.getRSArea().getNearestTile(getMyPlayer().getLocation()));

      return i < j ? DebaucherySoulWars.Location.EAST_GRAVE_OUT : DebaucherySoulWars.Location.WEST_GRAVE_OUT;
    }
    if (controlsWesternGraveyard())
      return DebaucherySoulWars.Location.WEST_GRAVE_OUT;
    if (controlsEasternGraveyard()) {
      return DebaucherySoulWars.Location.EAST_GRAVE_OUT;
    }
    return null;
  }

  private boolean listenTime() {
    if (getLocation().equals(DebaucherySoulWars.Location.OUTSIDE)) {
      return true;
    }
    String str = this.interfaces.get(836).getComponent(27).getText();

    return (str == null) || ((str != null) && ((str.equals("7 mins")) || (str.equals("6 mins")) || (str.equals("5 mins")) || (str.equals("4 mins")) || (str.equals("3 mins")) || (str.equals("2 mins")) || (str.equals("1 min"))));
  }

  public Color getColor(int paramInt1, int paramInt2)
  {
    try
    {
      BufferedImage localBufferedImage = this.env.takeScreenshot(false);
      int i = localBufferedImage.getRGB(paramInt1, paramInt2);
      return new Color(i); } catch (Exception localException) {
    }
    return null;
  }

  private void playersStrat()
  {
    if (getLocation().equals(DebaucherySoulWars.Location.OBELISK)) {
      heal();
      qPrayer();
      attack();
      weaponSpec();
    }
    else if ((!this.inventory.containsOneOf(new int[] { 14640 })) && ((this.getSupplies) || (this.healOthers)))
    {
      if (getLocation().equals(nearestSupplies()))
        getSupplies();
      else
        walkTo(nearestSupplies());
    }
    else {
      walkTo(DebaucherySoulWars.Location.OBELISK);
    }
  }

  private void pyresStrat()
  {
    if (getLocation().equals(nearestPyres())) {
      heal();
      qPrayer();
      attackPyres();
      weaponSpec();
    }
    else if ((!this.inventory.containsOneOf(new int[] { 14640 })) && ((this.getSupplies) || (this.healOthers)))
    {
      if (getLocation().equals(nearestSupplies()))
        getSupplies();
      else
        walkTo(nearestSupplies());
    }
    else {
      walkTo(nearestPyres());
    }
  }

  private void jelliesStrat()
  {
    if (getLocation().equals(nearestJellies())) {
      heal();
      qPrayer();
      attackJellies();
      weaponSpec();
    }
    else if ((!this.inventory.containsOneOf(new int[] { 14640 })) && ((this.getSupplies) || (this.healOthers)))
    {
      if (getLocation().equals(nearestSupplies())) {
        getSupplies();
      }
      else
        walkTo(nearestSupplies());
    }
    else {
      walkTo(nearestJellies());
    }
  }

  private void healPlayersStrat()
  {
    try {
      if (!this.inventory.containsOneOf(new int[] { 14640 })) {
        if (getLocation().equals(nearestSupplies()))
          getSupplies();
        else {
          walkTo(nearestSupplies());
        }
      }
      else if (getLocation().equals(DebaucherySoulWars.Location.OBELISK)) {
        if (getActivityBarPercent() < random(70, 80))
          healOthers();
        else
          pickUpArrows();
      }
      else
        walkTo(DebaucherySoulWars.Location.OBELISK);
    }
    catch (Exception localException)
    {
    }
  }

  private void bonesStrat() {
    try {
      if ((this.buryAtGrave) && ((getLocation().equals(DebaucherySoulWars.Location.EAST_GRAVE_OUT)) || (getLocation().equals(DebaucherySoulWars.Location.WEST_GRAVE_OUT)))) if (this.inventory.containsOneOf(new int[] { 14638 }))
        {
          if (getActivityBarPercent() < 70) {
            buryBones(); return;
          }
          localRSGroundItem = this.groundItems.getNearest(new int[] { 14638 });
          if ((localRSGroundItem != null) && 
            (localRSGroundItem.isOnScreen()) && (!this.inventory.isFull())) {
            localRSGroundItem.doAction("Take " + localRSGroundItem.getItem().getName());
            return;
          }

          return;
        }
      if ((this.buryAtGrave) && (this.inventory.isFull()) && 
        (nearestOwnedGrave() != null)) {
        walkTo(nearestOwnedGrave());
        return;
      }

      RSGroundItem localRSGroundItem = this.groundItems.getNearest(new int[] { 14638 });
      if ((localRSGroundItem != null) && 
        (this.calc.distanceTo(localRSGroundItem.getLocation()) < 5) && (!this.inventory.isFull()))
      {
        if ((getActivityBarPercent() < random(50, 80)) || (this.buryAtGrave))
        {
          localRSGroundItem.doAction("Take " + localRSGroundItem.getItem().getName());
          return;
        }
      }

      if (getLocation().equals(DebaucherySoulWars.Location.OBELISK)) {
        localRSGroundItem = this.groundItems.getNearest(new int[] { 14638 });
        if (localRSGroundItem != null) {
          if (!localRSGroundItem.isOnScreen()) {
            this.camera.turnTo(localRSGroundItem.getLocation());
            if (!localRSGroundItem.isOnScreen()) {
              this.walking.walkTileMM(localRSGroundItem.getLocation());
              sleep(1000, 1200);
            }
          }
          else if (!this.inventory.isFull()) {
            if (getActivityBarPercent() < 70) {
              localRSGroundItem.doAction("Take " + localRSGroundItem.getItem().getName());
            }
            else {
              pickUpArrows();
            }
          }
          else if ((!this.buryAtGrave) && (nearestOwnedGrave() != null)) {
            destroyBones();
          }
        }
      }
      else
      {
        walkTo(DebaucherySoulWars.Location.OBELISK);
      }
    }
    catch (Exception localException) {
    }
  }

  private void avatarStrat() {
    if (getLocation().equals(DebaucherySoulWars.Location.OBELISK)) {
      heal();
      qPrayer();
      attackAvatar();
      weaponSpec();
    }
    else if ((!this.inventory.containsOneOf(new int[] { 14640 })) && ((this.getSupplies) || (this.healOthers)))
    {
      if (getLocation().equals(nearestSupplies()))
        getSupplies();
      else
        walkTo(nearestSupplies());
    }
    else {
      walkTo(getMyPlayer().getTeam() == 1 ? DebaucherySoulWars.Location.RED_AVATAR : DebaucherySoulWars.Location.BLUE_AVATAR);
    }
  }

  private DebaucherySoulWars.Strategies getStrategies()
  {
    if (this.randomStrat) {
      switch (random(0, 5)) {
      case 0:
        if (!this.pickUpBones) break;
        return DebaucherySoulWars.Strategies.PICKUP_BONES;
      case 1:
        if (this.healOthers) {
          return DebaucherySoulWars.Strategies.HEAL_PLAYERS;
        }
      case 2:
        if (this.skills.getCurrentLevel(18) >= 30) {
          return DebaucherySoulWars.Strategies.ATTACK_PYRES;
        }
      case 3:
        if (this.skills.getCurrentLevel(18) >= 52) {
          return DebaucherySoulWars.Strategies.ATTACK_JELLIES;
        }
      case 4:
        return DebaucherySoulWars.Strategies.ATTACK_PLAYERS;
      }
      return DebaucherySoulWars.Strategies.ATTACK_PLAYERS;
    }

    if (this.pureMode) {
      if ((this.pickUpBones) && (this.healOthers)) {
        switch (random(0, 2)) {
        case 0:
          return DebaucherySoulWars.Strategies.PICKUP_BONES;
        case 1:
          return DebaucherySoulWars.Strategies.HEAL_PLAYERS;
        }
      }
      if (this.pickUpBones) {
        return DebaucherySoulWars.Strategies.PICKUP_BONES;
      }
      if (this.healOthers) {
        return DebaucherySoulWars.Strategies.HEAL_PLAYERS;
      }
    }
    if (getActivityBarPercent() < 70) {
      if ((this.pickUpBones) && (this.healOthers)) {
        switch (random(0, 2)) {
        case 0:
          return DebaucherySoulWars.Strategies.PICKUP_BONES;
        case 1:
          return DebaucherySoulWars.Strategies.HEAL_PLAYERS;
        }
      }
      if (this.pickUpBones) {
        return DebaucherySoulWars.Strategies.PICKUP_BONES;
      }

      if (this.healOthers)
        return DebaucherySoulWars.Strategies.HEAL_PLAYERS;
    }
    else
    {
      if ((getOpponentAvatarLevel() < this.skills.getRealLevel(18)) && (this.attackAvatar))
      {
        return DebaucherySoulWars.Strategies.ATTACK_AVATAR;
      }

      if (this.attackPyres) {
        return DebaucherySoulWars.Strategies.ATTACK_PYRES;
      }
      if (this.attackJellies) {
        return DebaucherySoulWars.Strategies.ATTACK_JELLIES;
      }
      if (this.attackPlayers) {
        return DebaucherySoulWars.Strategies.ATTACK_PLAYERS;
      }
    }

    return null;
  }

  private DebaucherySoulWars.Location getLocation()
  {
    RSTile localRSTile = getMyPlayer().getLocation();
    for (DebaucherySoulWars.Location localLocation : DebaucherySoulWars.Location.values()) {
      if (localLocation.containsTile(localRSTile)) {
        return localLocation;
      }
    }
    return DebaucherySoulWars.Location.OTHER;
  }

  private void walkTo(DebaucherySoulWars.Location paramLocation) {
    long l = System.currentTimeMillis();
    try {
      this.path = this.walking.getPath(paramLocation.getRSArea().getCentralTile());
      this.tempTile = paramLocation.getRSArea().getCentralTile();
      while (this.path.getNext() == null) {
        if ((this.game.getClientState() == 7) || (!this.game.isLoggedIn()) || (getLocation().equals(DebaucherySoulWars.Location.OUTSIDE)) || (getLocation().equals(DebaucherySoulWars.Location.RED_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.BLUE_SPAWN)) || (getLocation().equals(DebaucherySoulWars.Location.EAST_GRAVE)) || (getLocation().equals(DebaucherySoulWars.Location.WEST_GRAVE)))
        {
          return;
        }
        this.tempTile = divideTile(this.tempTile);
        this.path = this.walking.getPath(this.tempTile);
        if ((this.path.getNext() != null) || 
          (l + 2000L >= System.currentTimeMillis()) || (!getMyPlayer().isMoving()))
          continue;
        this.walking.walkTileMM(this.walking.getClosestTileOnMap(paramLocation.getRSArea().getCentralTile()));
      }

      if (this.path.getNext() != null)
        this.path.traverse();
    }
    catch (Exception localException)
    {
    }
  }

  public void messageReceived(MessageEvent paramMessageEvent)
  {
    String str = paramMessageEvent.getMessage().toLowerCase();
    if ((paramMessageEvent.getID() == 0) || (paramMessageEvent.getID() == 11) || (paramMessageEvent.getID() == 109))
    {
      if (str.contains("you receive 1 zeal")) {
        this.lost += 1;
        this.result = "lostLast";
        this.zeal += 1;
      } else if (str.contains("you receive 2 zeal")) {
        this.drew += 1;
        this.result = "drewLast";
        this.zeal += 2;
      } else if (str.contains("you receive 3 zeal")) {
        this.won += 1;
        this.result = "wonLast";
        this.zeal += 3;
      } else if (str.contains("This chat is currently full")) {
        this.inClan = false;
      } else if (str.contains("You have been kicked from the channel"))
      {
        this.inClan = false;
        log("You got kicked from clan channel!");
      } else if (str.contains("You are temporarily banned from this clan channel"))
      {
        this.inClan = false;
        log("You got banned from clan channel!");
      } else if (str.contains("You cannot take non-combat items into the arena"))
      {
        log("You have something that it stopping us from entering a game.");
        this.game.logout(true);
        stopScript();
      }
    }
    if ((this.clanChatTeam) && (listenTime()) && 
      (paramMessageEvent.getID() == 9)) {
      str.replace("-", "");
      str.replace("=", "");
      str.replace(";", "");
      str.replace(":", "");
      str.replace("*", "");
      str.replace("$", "");
      str.replace("£", "");
      str.replace("_", "");
      if ((!str.contains("bot")) && (!str.contains("winnin")) && (!str.contains("losin")))
      {
        if ((str.contains("blue")) || (str.contains("b l u e")) || (str.contains("b  l  u  e")))
        {
          this.blueShouts += 1;
        } else if ((str.contains("red")) || (str.contains("r e d")) || (str.contains("r  e  d")))
        {
          this.redShouts += 1;
        }
      }
    }
  }

  private Image getImage(String paramString)
  {
    try
    {
      return ImageIO.read(new URL(paramString));
    } catch (IOException localIOException) {
    }
    return null;
  }

  public void onRepaint(Graphics paramGraphics)
  {
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
    localGraphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    if (!this.hide) {
      this.hideRect = new Rectangle(503, 210, 14, 14);
      localGraphics2D.setColor(new Color(0, 0, 0, 100));
      localGraphics2D.fillRect(0, 208, 519, 130);
      localGraphics2D.setColor(new Color(0, 0, 0));
      localGraphics2D.setStroke(new BasicStroke(1.0F));
      localGraphics2D.drawRect(0, 208, 519, 130);
      localGraphics2D.drawImage(this.img1, 2, 209, null);
      localGraphics2D.setFont(new Font("SansSerif", 0, 15));
      localGraphics2D.setColor(new Color(255, 255, 255, 200));
      localGraphics2D.drawString("Version: " + ((ScriptManifest)getClass().getAnnotation(ScriptManifest.class)).version(), 119, 332);

      localGraphics2D.setFont(new Font("SansSerif", 0, 10));
      localGraphics2D.drawString("Time:  " + this.run.toElapsedString(), 300, 219);
      localGraphics2D.drawString("Current Task:  " + this.task, 300, 234);
      localGraphics2D.drawString("Zeal:  " + this.zeal, 300, 251);
      localGraphics2D.drawString("Won:  " + this.won, 300, 268);
      localGraphics2D.drawString("Lost:  " + this.lost, 300, 285);
      localGraphics2D.drawString("Drew:  " + this.drew, 300, 302);
      localGraphics2D.drawString("Kicked:  " + this.kicked, 300, 319);
      if (this.clanChatTeam) {
        localGraphics2D.drawString("Clan Team Calls", 420, 285);
        localGraphics2D.drawString("Blue:  " + this.blueShouts, 420, 302);
        localGraphics2D.drawString("Red:  " + this.redShouts, 420, 319);
      }
      if (this.takeBreak) {
        localGraphics2D.drawString("" + this.breakHandlerStatus, 300, 336);
      }
      localGraphics2D.drawImage(this.hideImg, 504, 210, null);
    } else {
      this.hideRect = new Rectangle(503, 324, 14, 14);
      localGraphics2D.setColor(new Color(0, 0, 0, 100));
      localGraphics2D.fillRect(368, 322, 150, 16);
      localGraphics2D.setColor(new Color(0, 0, 0));
      localGraphics2D.setStroke(new BasicStroke(1.0F));
      localGraphics2D.drawRect(368, 322, 150, 16);
      localGraphics2D.drawImage(this.hideImg, 503, 324, null);
      localGraphics2D.setColor(new Color(255, 255, 255, 200));
      localGraphics2D.setFont(new Font("SansSerif", 0, 10));
      localGraphics2D.drawString("Time: " + this.run.toElapsedString() + " | Zeal: " + this.zeal, 372, 335);
    }
  }

  public void mouseClicked(MouseEvent paramMouseEvent)
  {
    Point localPoint = paramMouseEvent.getPoint();
    if (this.hideRect.contains(localPoint))
      this.hide = (!this.hide);
  }

  public void mousePressed(MouseEvent paramMouseEvent)
  {
  }

  public void mouseReleased(MouseEvent paramMouseEvent)
  {
  }

  public void mouseEntered(MouseEvent paramMouseEvent)
  {
  }

  public void mouseExited(MouseEvent paramMouseEvent)
  {
  }

  public void onFinish()
  {
    DebaucherySoulWars.Angle.access$6302(this.angle, true);
    DebaucherySoulWars.Pitch.access$6402(this.pitch, true);
    DebaucherySoulWars.ExtraAntiban.access$6502(this.extraAntiban, true);
    if (this.breakHandler != null) {
      DebaucherySoulWars.BreakHandler.access$6602(this.breakHandler, true);
    }
    log("Thanks for using DebaucherySoulWars");
  }
}